package com.feng.common.validation.validator;

import cn.hutool.core.lang.Validator;
import com.feng.common.validation.constraints.Phone;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * @author Feng
 * @since 2022/4/19 18:11
 */
public class PhoneValidator implements ConstraintValidator<Phone, String> {
    @Override
    public boolean isValid(String number, ConstraintValidatorContext context) {
        return number == null || Validator.isMobile(number);
    }
}
